angular.module('${menuCode}')
.filter('to_trusted', ['$sce', function ($sce) {
	return function (text) {
	    return $sce.trustAsHtml(text);
	};
}])
.controller("${widgetCode}Ctrl",function($scope,AppKit){
	$scope.setActiveTab = function (activeTab) {     
		　　$scope.activeTab = activeTab; 
	};
	
	$scope.initTabs = function(tabs){
		$scope.tabs = tabs;	
		$scope.activeTab = tabs[0];
	}	
	
	$scope.loadToduTaskDate = function(){
		var url = '/aeaiem/services/TodoTaskDataProvider/rest/get-task-list';
		var promise = AppKit.getJsonApi(url);
		promise.success(function(rspJson){
			$scope.wait = rspJson.wait;
			$scope.process = rspJson.process;
			$scope.over = rspJson.over;
			
			$scope.waitLength = $scope.wait.length;
			$scope.processLength = $scope.process.length;
			$scope.overLength = $scope.over.length;
		});
	}
	$scope.loadToduTaskDate();
	
	$scope.openModal = function(id,state,theme,WFP_ID,WFA_CODE,WFIP_ID,mobileModal){
		$scope.modalTitle = theme;
		$scope.detailId = id;
		$scope.WFP_ID = WFP_ID;
		$scope.WFA_CODE = WFA_CODE;
		$scope.WFIP_ID = WFIP_ID;
		if(state == 'Expreimbursement'){  
				AppKit.createModal("${menuCode}",mobileModal,$scope);	
		}else if(state == 'Emevection'){
				AppKit.createModal("${menuCode}",mobileModal,$scope);	
		}   
	}
	
	$scope.openDetailModal = function(id,state,theme,WFP_CODE){
		$scope.modalTitle = theme;
		$scope.detailId = id;
		$scope.WFA_CODE = "detail";
		if(WFP_CODE == 'Expreimbursement'){  
				AppKit.createModal("${menuCode}","CostTaskDetailModal",$scope);	
		}else if(WFP_CODE == 'Emevection'){
				AppKit.createModal("${menuCode}","EvectionTaskDetailModal",$scope);	
		}   
	}
	
	
	
});